/**
 * Desenvolvido pela Fábrica de Software do CESUPA.
 * Todos os direitos reservados.
 */

/**
 * Commons scripts used along the application.
 * 
 * @author Breno Leite
 */

/**
 * Set the focus of the window on a UI element.
 */
function setFocusAtElement(elementName) {
    document.getElementById(elementName).focus();
}

/**
 * Calls the browser printer window.
 */
function printDocument() {
    window.print();
}

/**
 * Returns to last viewed page if there is some.
 */
function goToPreviousPage(){
    history.go(-1);
}

// getBrowserWidth is taken from The Man in Blue Resolution Dependent Layout Script
// http://www.themaninblue.com/experiment/ResolutionLayout/
function getBrowserWidth(){
    if (window.innerWidth){
        return window.innerWidth;
    }
    else if (document.documentElement && document.documentElement.clientWidth != 0){
        return document.documentElement.clientWidth;
    }
    else if (document.body){
        return document.body.clientWidth;
    }
    return 0;
}